package com.xinz.server.socket;

import java.io.IOException;

import org.jboss.netty.channel.Channel;

import com.xinz.protocal.Buffer;
import com.xinz.protocal.Session;
import com.xinz.protocal.SrmiDefine;
import com.xinz.protocal.client.InvokeConnector;

public class SocketChannelInvokeConnector implements InvokeConnector {

	Session spotSession;
	
	Channel channel;
	
	public SocketChannelInvokeConnector(Session spotSession, Channel ioSession) {
		this.spotSession = spotSession;
		this.channel = ioSession;
	}
	
	@Override
	public Session getSession() {
		return spotSession;
	}

	@Override
	public Buffer request(Buffer request) throws IOException {
		request.type = SrmiDefine.TYPE_REQUEST_NORETURN;
		channel.write(request);
		return null;
	}

}
